package com.cy.module.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ModuleController {
    @RequestMapping("/doHandleRequst/{n1}/{n2}")
    @ResponseBody
    public String doHandleRequst(@PathVariable Integer n1, @PathVariable Integer n2) {
        Integer requst = null;
        requst = n1 / n2;
        return "is requst=" + requst;
    }

    @ExceptionHandler(ArithmeticException.class)
    @ResponseBody
    public String doHandArithExe(ArithmeticException exception) {
        System.out.println("ModuleController");
        return "除数不能为0";
    }
}
